<template>
	<view class="content">
		<image src="../../static/mine/blue-bg.png" mode="widthFix" class="bg-img"></image>
		<CustomNav :topBgColor="topBgColor" :color="titleColor" :backColor="'#999'" :isBack="false" :custom="custom"
			:title="'我的'"></CustomNav>
		<view class="mine-item">
			<image :src="user.faceUrl" class="mine-img"></image>
			<view class="mine-name">{{user.userName ?user.userName:'微信用户'}}</view>
		</view>
		<view class="info-block">
			<view class="info-item" @click="navigate('/page_other/personal-information/personal-information')">
				<view class="left-item">
					<image src="../../static/home/user-5-fill.png" class="iconfont3">
					</image>
					<view class="title">个人信息</view>
				</view>
				<image src="../../static/mine/more.png" style="width: 40rpx; height: 40rpx;margin-right: 30rpx;">
				</image>
			</view>
			<view class="info-item" @click="navigate('/page_other/my-clap/my-clap')">
				<view class="left-item">
					<image src="../../static/mine/clap-blue.png" class="iconfont1">
					</image>
					<view class="title">我的随手拍</view>
				</view>
				<image src="../../static/mine/more.png" style="width: 40rpx; height: 40rpx;margin-right: 30rpx;">
				</image>
			</view>
			<view class="info-item" @click="navigate('/page_other/my-integral/my-integral')">
				<view class="left-item">
					<image src="../../static/mine/integral.png" class="iconfont">
					</image>
					<view class="title">我的积分</view>
				</view>
				<image src="../../static/mine/more.png" style="width: 40rpx; height: 40rpx;margin-right: 30rpx;">
				</image>
			</view>
			<view class="info-item" @click="logout">
				<view class="left-item">
					<image src="../../static/mine/exit.png" class="iconfont2">
					</image>
					<view class="title">退出登录</view>
				</view>
				<image src="../../static/mine/more.png" style="width: 40rpx; height: 40rpx;margin-right: 30rpx;">
				</image>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getCustomNavData
	} from '@/util/util.js';
	import {
		getStorage,
		removeStorage
	} from '@/util/auth.js'
	export default {
		data() {
			return {
				custom: null,
				topBgColor: 'rgba(0,0,0,0)',
				titleColor: '#fff',
				user: {
					faceUrl: '',
					userName: ''
				}
			}
		},
		onPageScroll(e) {
			if (e.scrollTop >= 50) {
				this.topBgColor = '#117DFF';
			} else {
				this.topBgColor = 'rgba(0,0,0,0)';
			}
		},
		methods: {
			navigate(url) {
				uni.navigateTo({
					url
				})
			},
			logout() {
				uni.showModal({
					title: '提示',
					content: `确定要退出重新登录吗？`,
					confirmColor: '#027BFD',
					success: (res) => {
						if (res.confirm) {
							removeStorage('login');
							uni.reLaunch({
								url: '/pages/home/index'
							})
						}
					}
				})
			},
		},
		onShow() {
			const loginInfo = getStorage('login');
			if (loginInfo) {
				this.user = loginInfo
			}
		},
		onLoad() {
			this.custom = getCustomNavData();
		},
	}
</script>

<style lang="scss" scoped>
	page {
		background: #F5F5F5;
	}

	.content {
		background: #F5F5F5;
		width: 100%;


		.bg-img {
			width: 100%;
			//position: relative;
		}

		.mine-item {
			position: absolute;
			margin-top: -460rpx;
			display: flex;
			flex-direction: row;
			padding: 30rpx;
			align-items: center;

			.avatar-wrapper {
				margin: 0;
				padding: 0;
				border: 0;

			}

			.mine-img {
				width: 150rpx;
				height: 150rpx;
				border-radius: 50%;
				background: #F5F5F5;
				margin-right: 30rpx;
			}

			.mine-name {
				color: #fff;
				font-weight: bold;
				font-size: 40rpx;
			}
		}

		.info-block {
			display: flex;
			flex-direction: column;
			background: #fff;
			margin-top: -230rpx;
			border-radius: 60rpx;
			height: auto;
			position: relative;
			padding: 30rpx;

			.info-item {
				height: 160rpx;
				box-shadow: 0 0 10px 0 #dedede;
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				margin-top: 30rpx;
				align-items: center;
				border-radius: 20rpx;
				padding-left: 40rpx;

				.left-item {
					display: flex;
					flex-direction: row;
					align-items: center;

					.iconfont {
						width: 43rpx;
						height: 42rpx;
						margin-right: 20rpx;
					}

					.iconfont1 {
						width: 40rpx;
						height: 36rpx;
						margin-right: 20rpx;
					}

					.iconfont2 {
						width: 37rpx;
						height: 37rpx;
						margin-right: 20rpx;
					}

					.iconfont3 {
						width: 43rpx;
						height: 45rpx;
						margin-right: 20rpx;
					}

					.title {
						font-weight: bold;
					}
				}
			}
		}
	}
</style>